package com.heima.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.reggie.domain.ShoppingCart;
import com.heima.reggie.service.ShoppingCartService;
import com.heima.reggie.mapper.ShoppingCartMapper;
import org.springframework.stereotype.Service;

/**
* @author liulanhui
* @description 针对表【shopping_cart(购物车)】的数据库操作Service实现
* @createDate 2023-01-11 21:28:34
*/
@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart>
    implements ShoppingCartService{

    @Override
    public void cleanShoppingCart(Long userId) {
        LambdaQueryWrapper<ShoppingCart> shoppingCartLambdaQueryWrapper = new LambdaQueryWrapper<>();
        shoppingCartLambdaQueryWrapper.eq(ShoppingCart :: getUserId , userId);
        this.remove(shoppingCartLambdaQueryWrapper);
    }
}




